package com.dhecp.project.oa.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhecp.core.constant.DataFiltering;
import com.dhecp.core.utils.PageUtils;
import com.dhecp.project.oa.domain.OfficeStock;
import com.dhecp.project.oa.mapper.OfficeStockMapper;
import com.dhecp.project.oa.service.OfficeStockService;
import com.dhecp.project.system.service.SysDictionaryForFieldService;

/**
 * 办公用品库存  业务实现层
 * @author DH-lwl
 * @version 2020年7月22日
 */
@Service
public class OfficeStockServiceImpl implements OfficeStockService {

	@Autowired
	private OfficeStockMapper officeStockMapper;

	@Autowired
	private SysDictionaryForFieldService dictionaryForFieldService;
	
	/**
	 * 查询所有信息
	 * @param params
	 * @return List-OfficeStock
	 * @author lwl
	 * @throws Exception 
	 */
	@Override
	public List<OfficeStock> queryAll(Map<String, Object> params)
			throws Exception {
		// TODO Auto-generated method stub
        params.put(DataFiltering.TABLE_ALIAS, "t1");	//查询表别名
		params.put(DataFiltering.DATA_WHERE, dictionaryForFieldService.getWhereStr(params));

        params.put(DataFiltering.TABLE_ALIAS, "J1");	//数据权限表别名
		params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));

		if (params.get("field") == null || params.get("field") == ""){
			String orderBy = "bNumb asc";
			PageUtils.startPageOrder(orderBy);
		}else{
			PageUtils.startPage();	
		}	
		
		return officeStockMapper.findAll(params);
	}

}
